package client.editor;

import javax.swing.*;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.ComponentOrientation;
import java.awt.Container;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

public class EditorGUI extends JFrame {
	
	public EditorGUI(){
		super("Milstrat Editor");
		this.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
		//TODO this.setBackground(Color.darkGray);
		this.setLayout(new BorderLayout());
		addComponents();
		this.pack();		
		this.setVisible(true);
	}
	
	public void addComponents(){
		
		//menubar
		JMenuItem menuSave = new JMenuItem("Save");
		JMenuItem menuLoad = new JMenuItem("Load");
		JMenuItem menuNewUnit = new JMenuItem("New Unit");
		JMenuBar menubarMain = new JMenuBar();
		menubarMain.add(menuSave);
		menubarMain.add(menuLoad);
		menubarMain.add(menuNewUnit);
		this.add(menubarMain,BorderLayout.NORTH);

		
		JPanel table = new JPanel();
		table.setLayout(new GridBagLayout());
		this.add(table,BorderLayout.SOUTH);
		
		//1. Zeile
		JButton ButtonPrev = new JButton("Previous");
		table.add(ButtonPrev,new GridBagConstraints(0,0,1,1,1,1,GridBagConstraints.CENTER,GridBagConstraints.BOTH,new Insets(0,0,0,0),40,12));
		
		String[] panzerArray = {"Abrams","Leopard","T90","Superman"};
		JComboBox tankCount = new JComboBox (panzerArray);
		table.add(tankCount,new GridBagConstraints(1,0,2,1,2,1,GridBagConstraints.CENTER,GridBagConstraints.BOTH,new Insets(0,0,0,0),40,12));
		
		JButton buttonNext = new JButton("Next");
		table.add(buttonNext,new GridBagConstraints(4,0,1,1,1,1,GridBagConstraints.CENTER,GridBagConstraints.BOTH,new Insets(0,0,0,0),40,12));
		
		//2. Zeile
		JLabel vehicletypeLabel = new JLabel("Fahrzeugart: ");
		table.add(vehicletypeLabel,new GridBagConstraints(0,1,1,1,1,1,GridBagConstraints.EAST,GridBagConstraints.NONE,new Insets(0,0,0,0),40,12));
		
		String[] vehicletypes = {"Land","Wasser","Luft","Amphibisch"};
		JComboBox vehicletype = new JComboBox(vehicletypes);
		table.add(vehicletype,new GridBagConstraints(1,1,1,1,1,1,GridBagConstraints.EAST,GridBagConstraints.BOTH,new Insets(0,0,0,0),40,12));
		
		JButton buttonErstellen = new JButton("Erstellen");
		table.add(buttonErstellen,new GridBagConstraints(2,1,3,2,1,1,GridBagConstraints.CENTER,GridBagConstraints.BOTH,new Insets(0,0,0,0),80,24));
		
		//3. Zeile
		JLabel testlabel = new JLabel("Bams: ");
		table.add(testlabel,new GridBagConstraints(0,2,1,1,1,1,GridBagConstraints.EAST,GridBagConstraints.NONE,new Insets(0,0,0,0),40,12));
		
		String[] test = {"test1","test2","test3","test4"};
		JComboBox testcombo = new JComboBox(test);
		table.add(testcombo,new GridBagConstraints(1,2,1,1,1,1,GridBagConstraints.EAST,GridBagConstraints.BOTH,new Insets(0,0,0,0),40,12));
		
		//4. Zeile
		JLabel maxHP = new JLabel("MaxHitpoints: ");
		table.add(maxHP,new GridBagConstraints(0,3,1,1,1,1,GridBagConstraints.EAST,GridBagConstraints.NONE,new Insets(0,0,0,0),40,12));
		
		JTextField textMaxHP = new JTextField();
		table.add(textMaxHP,new GridBagConstraints(1,3,1,1,1,1,GridBagConstraints.EAST,GridBagConstraints.BOTH,new Insets(0,0,0,0),40,12));
				
		JLabel maxFuel = new JLabel("MaxFuel: ");
		table.add(maxFuel,new GridBagConstraints(2,3,1,1,1,1,GridBagConstraints.EAST,GridBagConstraints.NONE,new Insets(0,0,0,0),40,12));
		
		JTextField textMaxFuel = new JTextField();
		table.add(textMaxFuel,new GridBagConstraints(4,3,1,1,1,1,GridBagConstraints.EAST,GridBagConstraints.BOTH,new Insets(0,0,0,0),40,12));
		
		//5. Zeil
		JLabel AttPoints = new JLabel("Attackpoints: ");
		table.add(AttPoints,new GridBagConstraints(0,4,1,1,1,1,GridBagConstraints.EAST,GridBagConstraints.NONE,new Insets(0,0,0,0),40,12));
		
		JTextField textAttPoints = new JTextField();
		table.add(textAttPoints,new GridBagConstraints(1,4,1,1,1,1,GridBagConstraints.EAST,GridBagConstraints.BOTH,new Insets(0,0,0,0),40,12));
				
		JLabel fuelUse = new JLabel("Fuelusage: ");
		table.add(fuelUse,new GridBagConstraints(2,4,1,1,1,1,GridBagConstraints.EAST,GridBagConstraints.NONE,new Insets(0,0,0,0),40,12));
		
		JTextField textfuelUse = new JTextField();
		table.add(textfuelUse,new GridBagConstraints(4,4,1,1,1,1,GridBagConstraints.EAST,GridBagConstraints.BOTH,new Insets(0,0,0,0),40,12));
		
		//6. Zeile
		JLabel price = new JLabel("Price: ");
		table.add(price,new GridBagConstraints(0,5,1,1,1,1,GridBagConstraints.EAST,GridBagConstraints.NONE,new Insets(0,0,0,0),40,12));
		
		JTextField textprice = new JTextField();
		table.add(textprice,new GridBagConstraints(1,5,1,1,1,1,GridBagConstraints.EAST,GridBagConstraints.BOTH,new Insets(0,0,0,0),40,12));
				
		JLabel maxAmmo = new JLabel("MaxAmmonition: ");
		table.add(maxAmmo,new GridBagConstraints(2,5,1,1,1,1,GridBagConstraints.EAST,GridBagConstraints.NONE,new Insets(0,0,0,0),40,12));
		
		JTextField textmaxAmmo = new JTextField();
		table.add(textmaxAmmo,new GridBagConstraints(4,5,1,1,1,1,GridBagConstraints.EAST,GridBagConstraints.BOTH,new Insets(0,0,0,0),40,12));
		
		//7. Zeile
		JLabel maxSpeed = new JLabel("maxSpeed: ");
		table.add(maxSpeed,new GridBagConstraints(0,6,1,1,1,1,GridBagConstraints.EAST,GridBagConstraints.NONE,new Insets(0,0,0,0),40,12));
		
		JTextField textmaxSpeed = new JTextField();
		table.add(textmaxSpeed,new GridBagConstraints(1,6,1,1,1,1,GridBagConstraints.EAST,GridBagConstraints.BOTH,new Insets(0,0,0,0),40,12));
				
		JLabel Shootrange = new JLabel("Shootrange: ");
		table.add(Shootrange,new GridBagConstraints(2,6,1,1,1,1,GridBagConstraints.EAST,GridBagConstraints.NONE,new Insets(0,0,0,0),40,12));
		
		JTextField textShootrange = new JTextField();
		table.add(textShootrange,new GridBagConstraints(4,6,1,1,1,1,GridBagConstraints.EAST,GridBagConstraints.BOTH,new Insets(0,0,0,0),40,12));
		
	}

}
